import { Rule } from "./types";

export const NamingRules: Rule[] = [
    {
        id: "Naming/AccessorMethodName",
        enabled: true,
        descEn: "Check the naming of accessor methods for get_/set_.",
        descCn: "",
        versionAdded: "0.50",
        paramList: [],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingaccessormethodname",
    },
    {
        id: "Naming/AsciiIdentifiers",
        enabled: true,
        descEn: "Use only ascii symbols in identifiers and constants.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "0.87",
        paramList: [
            {
                param: "AsciiConstants",
                defaultValue: true,
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingasciiidentifiers",
    },
    {
        id: "Naming/BinaryOperatorParameterName",
        enabled: true,
        descEn: "When defining binary operators, name the argument other.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.2",
        paramList: [],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingbinaryoperatorparametername",
    },
    {
        id: "Naming/BlockForwarding",
        enabled: "pending",
        descEn: "Use anonymous block forwarding.",
        descCn: "",
        versionAdded: "1.24",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "anonymous",
                optionList: ["anonymous", "explicit"],
            },
            {
                param: "BlockForwardingName",
                defaultValue: "block",
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingblockforwarding",
    },
    {
        id: "Naming/BlockParameterName",
        enabled: true,
        descEn: "Checks for block parameter names that contain capital letters, end in numbers, or do not meet a minimal length.",
        descCn: "",
        versionAdded: "0.53",
        versionChanged: "0.77",
        paramList: [
            {
                param: "MinNameLength",
                defaultValue: 1,
            },
            {
                param: "AllowNamesEndingInNumbers",
                defaultValue: true,
            },
            {
                param: "AllowedNames",
                defaultValue: [],
            },
            {
                param: "ForbiddenNames",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingblockparametername",
    },
    {
        id: "Naming/ClassAndModuleCamelCase",
        enabled: true,
        descEn: "Use CamelCase for classes and modules.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "0.85",
        paramList: [
            {
                param: "AllowedNames",
                defaultValue: ["module_parent"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingclassandmodulecamelcase",
    },
    {
        id: "Naming/ConstantName",
        enabled: true,
        descEn: "Constants should use SCREAMING_SNAKE_CASE.",
        descCn: "",
        versionAdded: "0.50",
        paramList: [],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingconstantname",
    },
    {
        id: "Naming/FileName",
        enabled: true,
        descEn: "Use snake_case for source file names.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.23",
        paramList: [
            {
                param: "Exclude",
                defaultValue: [],
            },
            {
                param: "ExpectMatchingDefinition",
                defaultValue: false,
            },
            {
                param: "CheckDefinitionPathHierarchy",
                defaultValue: false,
            },
            {
                param: "CheckDefinitionPathHierarchyRoots",
                defaultValue: ["lib", "spec", "test", "src"],
            },
            {
                param: "Regex",
                defaultValue: null,
                demoValue: "",
            },
            {
                param: "IgnoreExecutableScripts",
                defaultValue: true,
            },
            {
                param: "AllowedAcronyms",
                defaultValue: ["CLI", "DSL", "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID",
                    "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC",
                    "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "UID", "UUID",
                    "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingfilename",
    },
    {
        id: "Naming/HeredocDelimiterCase",
        enabled: true,
        descEn: "Use configured case for heredoc delimiters.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.2",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "uppercase",
                optionList: ["lowercase", "uppercase"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingheredocdelimitercase",
    },
    {
        id: "Naming/HeredocDelimiterNaming",
        enabled: true,
        descEn: "Use descriptive heredoc delimiters.",
        descCn: "",
        versionAdded: "0.50",
        paramList: [
            {
                param: "ForbiddenDelimiters",
                defaultValue: [`(?i-mx:(^|\\s)(EO[A-Z]{1}|END)(\\s|$))`],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingheredocdelimiternaming",
    },
    {
        id: "Naming/InclusiveLanguage",
        enabled: false,
        descEn: "Recommend the use of inclusive language instead of problematic terms。",
        descCn: "",
        versionAdded: "1.18",
        versionChanged: "1.49",
        paramList: [
            {
                param: "CheckIdentifiers",
                defaultValue: true,
            },
            {
                param: "CheckConstants",
                defaultValue: true,
            },
            {
                param: "CheckVariables",
                defaultValue: true,
            },
            {
                param: "CheckStrings",
                defaultValue: false,
            },
            {
                param: "CheckSymbols",
                defaultValue: true,
            },
            {
                param: "CheckComments",
                defaultValue: true,
            },
            {
                param: "CheckFilepaths",
                defaultValue: true,
            },
            {
                param: "FlaggedTerms",
                defaultValue: {
                    "whitelist": {
                        "Regex": "/white[-\s]?list/",
                        "Suggestions": [
                            "allowlist",
                            "permit"
                        ]
                    },
                    "blacklist": {
                        "Regex": "/black[-\s]?list/",
                        "Suggestions": [
                            "denylist",
                            "block"
                        ]
                    },
                    "slave": {
                        "WholeWord": true,
                        "Suggestions": [
                            "replica",
                            "secondary",
                            "follower"
                        ]
                    }
                }
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#naminginclusivelanguage",
    },
    {
        id: "Naming/MemoizedInstanceVariableName",
        enabled: true,
        descEn: "Memoized method name should match memo instance variable name.",
        descCn: "",
        versionAdded: "0.53",
        versionChanged: "1.2",
        paramList: [
            {
                param: "EnforcedStyleForLeadingUnderscores",
                defaultValue: "disallowed",
                optionList: ["disallowed", "required", "optional"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingmemoizedinstancevariablename",
    },
    {
        id: "Naming/MethodName",
        enabled: true,
        descEn: "Use the configured style when naming methods.",
        descCn: "",
        versionAdded: "0.50",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "snake_case",
                optionList: ["snake_case", "camelCase"],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingmethodname",
    },
    {
        id: "Naming/MethodParameterName",
        enabled: true,
        descEn: "Checks for method parameter names that contain capital letters, end in numbers, or do not meet a minimal length.",
        descCn: "",
        versionAdded: "0.53",
        versionChanged: "0.77",
        paramList: [
            {
                param: "MinNameLength",
                defaultValue: 3,
            },
            {
                param: "AllowNamesEndingInNumbers",
                defaultValue: true,
            },
            {
                param: "AllowedNames",
                defaultValue: ["as", "at", "by", "cc", "db", "id", "if", "in", "io", "ip", "of", "on", "os", "pp", "to"],
            },
            {
                param: "ForbiddenNames",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingmethodparametername",
    },
    {
        id: "Naming/PredicateName",
        enabled: true,
        descEn: "Check the names of predicate methods.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "0.77",
        paramList: [
            {
                param: "NamePrefix",
                defaultValue: ["is_", "has_", "have_"],
            },
            {
                param: "ForbiddenPrefixes",
                defaultValue: ["is_", "has_", "have_"],
            },
            {
                param: "AllowedMethods",
                defaultValue: ["is_a?"],
            },
            {
                param: "MethodDefinitionMacros",
                defaultValue: ["define_method", "define_singleton_method"],
            },
            {
                param: "Exclude",
                defaultValue: ["spec/**/*"],
            },
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingpredicatename",
    },
    {
        id: "Naming/RescuedExceptionsVariableName",
        enabled: true,
        descEn: "Use consistent rescued exceptions variables naming.",
        descCn: "",
        versionAdded: "0.67",
        versionChanged: "0.68",
        paramList: [
            {
                param: "PreferredName",
                defaultValue: "e",
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingrescuedexceptionsvariablename",
    },
    {
        id: "Naming/VariableName",
        enabled: true,
        descEn: "Use the configured style when naming variables.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.8",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "snake_case",
                optionList: ["snake_case", "camelCase"],
            },
            {
                param: "AllowedIdentifiers",
                defaultValue: [],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingvariablename",
    },
    {
        id: "Naming/VariableNumber",
        enabled: true,
        descEn: "Use the configured style when numbering symbols, methods and variables.",
        descCn: "",
        versionAdded: "0.50",
        versionChanged: "1.4",
        paramList: [
            {
                param: "EnforcedStyle",
                defaultValue: "normalcase",
                optionList: ["snake_case", "normalcase", "non_integer"],
            },
            {
                param: "CheckMethodNames",
                defaultValue: true,
            },
            {
                param: "CheckSymbols",
                defaultValue: true,
            },
            {
                param: "AllowedIdentifiers",
                defaultValue: ["capture3", "iso8601", "rfc1123_date", "rfc822", "rfc2822", "rfc3339", "x86_64"],
            },
            {
                param: "AllowedPatterns",
                defaultValue: [],
            }
        ],
        url: "https://docs.rubocop.org/rubocop/1.50/cops_naming.html#namingvariablenumber",
    },
];